package com.zhu.gmallpublisher.mapper;

import com.zhu.gmallpublisher.bean.TrafficVisitorStatsPerHour;
import com.zhu.gmallpublisher.bean.TrafficVisitorTypeStats;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TrafficVisitorStatsMapper {


    //分时流量数据查询

    @Select("select toHour(stt) hr,sum(uv_ct) as uv_ct,sum(pv_ct) as pv_ct,sum(if(is_new = '1'," +
            " dws_traffic_vc_ch_ar_is_new_page_view_window.uv_ct, 0)) as new_uv_ct from dws_traffic_vc_ch_ar_is_new_page_view_window " +
            "where toYYYYMMDD(stt) = #{date} group by hr")
    List<TrafficVisitorStatsPerHour> selectVisitorStatsPerHr(Integer date);


    @Select("select is_new,sum(uv_ct) uv_ct,sum(pv_ct) pv_ct,sum(sv_ct) sv_ct,sum(uj_ct) uj_ct,sum(dur_sum) dur_sum " +
            "from dws_traffic_vc_ch_ar_is_new_page_view_window " +
            "where toYYYYMMDD(stt) =#{date} group by is_new")
    List<TrafficVisitorTypeStats> selectVisitorTypeStats(Integer date);


}
